/*VaWVqaRPOcVLGQLUZRykSxN43lbEnxQvSuDfiMhf4NYKgvGSAU5ZxOpOA4snWHov*/
import ampub from 'ampub';
const { commonConst: { CommonKeys: { IBusiRoleConst } } } = ampub;

export const dataSource = 'fa.newasset.assettransfer.main';
export const queryUrl = '/nccloud/ampub/common/amLinkQuery.do';
export const queryProfitUrl = '/nccloud/fa/assettransfer/LinkQuery.do';

//新增资产审批单常量
export const assetTransferPageCode = '201201520A_transfer';
export const assetTransferHead = '201201520A_head';
export const assetTransferBody = '201201520A_body';
export const assetTransferSearch = '201201520A_search';
export const assetAppcode = '201201520A';

export const assetMainTransferPageCode = '201201520A_transferMain';

//设备卡片
export const equipTransferPageCode = '451001008A_transfer';
export const equipTransferHead = '451001008A_head';
export const equipTransferBody = '451001008A_body';
export const equipTransferSearch = '451001008A_search';
export const equipAppcode = '451001008A';

export const equipMainTransferPageCode = '451001008A_transferMain';

//采购转固单
export const purTransferPageCode = '201201524A_transfer';
export const purTransferHead = '201201524A_head';
export const purTransferBody = '201201524A_body';
export const purTransferSearch = '201201524A_search';
export const purAppcode = '201201524A';

export const purMainTransferPageCode = '201201524A_transferMain';

//工程转固单
export const proTransferPageCode = '201201528A_transfer';
export const proTransferHead = '201201528A_head';
export const proTransferBody = '201201528A_body';
export const proTransferSearch = '201201528A_search';
export const proAppcode = '201201528A';

export const proMainTransferPageCode = '201201528A_transferMain';

//盘盈单
export const profitTransferPageCode = '2012048030A_transfer';
export const profitTransferHead = '2012048030A_head';
export const profitTransferBody = '2012048030A_body';
export const profitTransferSearch = '2012048030A_search';
export const profitAppcode = '201201512A';

export const profitMainTransferPageCode = '2012048030A_transferMain';

//资产租入
export const contractTransferPageCode = '453200504A_fatransfer';
export const contractTransferHead = 'head';
export const contractTransferBody = 'bodyvos';
export const contractTransferSearch = 'search';
export const contractAppcode = '453200504A';

export const contractMainTransferPageCode = '453200504A_famain';
export const contractMainTransferId = 'transfermain';

//全部
export const allTransferPageCode = 'all_transfer';
export const allTransferHead = 'all_head';
export const allTransferBody = 'all_body';
export const allTransferSearch = 'all_search';

export const allMainTransferPageCode = 'all_transferMain';

export const tabInfoIndexMap = {
	//全部
	0: {
		head: allTransferHead,
		body: allTransferBody,
		search: allTransferSearch,
		pageCode: allTransferPageCode,
		pageCodeFlat: allMainTransferPageCode
	},

	//新增资产审批单
	1: {
		head: assetTransferHead,
		body: assetTransferBody,
		search: assetTransferSearch,
		pageCode: assetTransferPageCode,
		pageCodeFlat: assetMainTransferPageCode,
		appcode: assetAppcode
	},
	//资产卡片
	2: {
		head: equipTransferHead,
		body: equipTransferBody,
		search: equipTransferSearch,
		pageCode: equipTransferPageCode,
		pageCodeFlat: equipMainTransferPageCode,
		appcode: equipAppcode
	},
	//采购转固
	3: {
		head: purTransferHead,
		body: purTransferBody,
		search: purTransferSearch,
		pageCode: purTransferPageCode,
		pageCodeFlat: purMainTransferPageCode,
		appcode: purAppcode
	},
	//工程转固
	4: {
		head: proTransferHead,
		body: proTransferBody,
		search: proTransferSearch,
		pageCode: proTransferPageCode,
		pageCodeFlat: proMainTransferPageCode,
		appcode: proAppcode
	},
	//盘盈
	5: {
		head: profitTransferHead,
		body: profitTransferBody,
		search: profitTransferSearch,
		pageCode: profitTransferPageCode,
		pageCodeFlat: profitMainTransferPageCode,
		appcode: profitAppcode
	},
	//资产租入
	6: {
		head: contractTransferHead,
		body: contractTransferBody,
		search: contractTransferSearch,
		pageCode: contractTransferPageCode,
		pageCodeFlat: contractMainTransferPageCode,
		appcode: contractAppcode
	}
};

export const KeyMap = {
	KeyMapNewToAll: {
		all_head: {
			pk: 'pk_newasset',
			pk_org: 'pk_org_v',
			bill_code: 'bill_code',
			business_date: 'business_date',
			pk_recorder: 'pk_transactor',
			transi_type: 'transi_type'
		},
		all_body: {
			pk_b: 'pk_newasset_b',
			asset_name: 'asset_name',
			asset_spec: 'spec',
			asset_type: 'card_model',
			pk_category: 'pk_category',
			asset_value: 'sum_money'
		}
	},
	KeyMapPurToAll: {
		all_head: {
			pk: 'pk_transasset',
			pk_org: 'pk_org_v',
			bill_code: 'bill_code',
			business_date: 'business_date',
			pk_recorder: 'pk_recorder',
			transi_type: 'transi_type'
		},
		all_body: {
			pk_b: 'pk_transasset_b',
			asset_name: 'asset_name',
			asset_spec: 'asset_spec',
			asset_type: 'asset_type',
			pk_category: 'pk_category',
			asset_value: 'pricetaxsum_value'
		}
	},
	KeyMapProToAll: {
		all_head: {
			pk: 'pk_transasset',
			pk_org: 'pk_org_v',
			bill_code: 'bill_code',
			business_date: 'business_date',
			pk_recorder: 'pk_recorder',
			transi_type: 'transi_type'
		},
		all_body: {
			pk_b: 'pk_transasset_b',
			asset_name: 'asset_name',
			asset_spec: 'asset_spec',
			asset_type: 'asset_type',
			pk_category: 'pk_category',
			asset_value: 'asset_value'
		}
	},
	KeyMapProfitToAll: {
		all_head: {
			pk: 'pk_profit',
			pk_org: 'pk_org_v',
			bill_code: 'bill_code',
			business_date: 'business_date'
			//经办人暂时为空pk_recorder: 'pk_recorder'
		},
		all_body: {
			pk_b: 'pk_profit_b',
			asset_name: 'asset_name',
			asset_spec: 'spec',
			asset_type: 'model',
			pk_category: 'pk_category'
			//盘盈没有金额asset_value: 'asset_value'
		}
	},
	KeyMapEquipToAll: {
		all_head: {
			pk: 'pk_equip',
			pk_org: 'pk_org_v',
			bill_code: 'equip_code',
			business_date: 'start_used_date',
			asset_name: 'equip_name',
			asset_spec: 'spec',
			asset_type: 'model',
			transi_type: 'transi_type',
			asset_value: 'purc_price'
			//经办人暂时为空pk_recorder: 'pk_recorder'
		},
		all_body: {
			pk_b: 'pk_equip'
			// asset_name: 'equip_name',
			// asset_spec: 'spec',
			// asset_type: 'model'
			//pk_category: 'purc_price'  //暂时是无税价格，回头确认
		}
	},
	KeyMapContractToAll: {
		all_head: {
			pk: 'pk_contract',
			pk_org: 'pk_org_v',
			bill_code: 'bill_code',
			business_date: 'effect_date',
			transi_type: 'transi_type'
			//经办人暂时为空pk_recorder: 'pk_recorder'
		},
		all_body: {
			pk_b: 'pk_contract_eq',
			asset_name: 'equip_name',
			asset_spec: 'spec',
			asset_type: 'model',
			pk_category: 'pk_category'
		}
	},
	KeyMapContractToSelf: {
		all_head: {
			pk: 'pk_contract',
			pk_org: 'pk_org_v',
			bill_code: 'bill_code',
			effect_date: 'effect_date',
			transi_type: 'transi_type'
			//经办人暂时为空pk_recorder: 'pk_recorder'
		},
		all_body: {
			pk_b: 'pk_contract_eq',
            asset_name: 'equip_name',
            asset_spec: 'spec',
            asset_type: 'model',
			pk_category: 'pk_category'
		}
	}
};

// 合同单据类型
const CONTRACT_BILL_TYPE = '4A3A';

//合同参照过滤配置
const ContractReferFilterConfig = {
	searchId: contractTransferSearch,

	specialFields: {
        // pk_recorder_in经办人 equip.pk_material_v物料 equip.pk_material物料 pk_jobmngfil项目 equip.pk_jobmngfil项目 出租方(pk_supplier)
        // 出租方
		pk_supplier: {
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_fiorg_in' ],
					returnName: 'pk_org'
				}
			]
		},
        // 经办人
		pk_recorder_in: {
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_fiorg_in' ],
					returnName: 'pk_org'
				}
			]
		},
        // 物料
		pk_material_v: {
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_fiorg_in' ],
					returnName: 'pk_org'
				}
			]
		},
        // 物料
		pk_material: {
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_fiorg_in' ],
					returnName: 'pk_org'
				}
			]
		},
        // 项目
		pk_jobmngfil: {
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_fiorg_in' ],
					returnName: 'pk_org'
				}
			]
		}
	}
};

//设备卡片参照过滤配置
const EquipReferFilterConfig = {
	searchId: equipTransferSearch,

	specialFields: {
        // pk_supplier供应商 pk_material_v物料 pk_jobmngfil项目	pk_usedept使用部门 pk_mandept管理部门
        // pk_supplier供应商
		pk_supplier: {
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_org_fi' ],
					returnName: 'pk_org'
				}
			]
		},
        // 物料
		pk_material_v: {
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_org_fi' ],
					returnName: 'pk_org'
				}
			]
		},
        //  pk_jobmngfil项目
		pk_jobmngfil: {
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_org_fi' ],
					returnName: 'pk_org'
				}
			]
		},
        // pk_usedept使用部门 
		pk_usedept: {
            isRunWithChildren: true, //是否执行时包含下级
			defaultRunWithChildren: true, //是否默认勾选执行时包含下级
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_usedunit', 'pk_org_fi' ],
					returnName: 'pk_org'
				}
			]
		},
        // pk_mandept管理部门
		pk_mandept: {
            isRunWithChildren: true, //是否执行时包含下级
			defaultRunWithChildren: true, //是否默认勾选执行时包含下级
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_ownerorg', 'pk_org_fi' ],
					returnName: 'pk_org'
				}
			]
		},
        // 管理人
		pk_manager: {
            orgMulti: 'pk_org',
			data: [
				{
					fields: [ 'pk_ownerorg', 'pk_org_fi' ],
					returnName: 'pk_org'
				}
			]
		},
	}
};

export { CONTRACT_BILL_TYPE, ContractReferFilterConfig, EquipReferFilterConfig };

/*VaWVqaRPOcVLGQLUZRykSxN43lbEnxQvSuDfiMhf4NYKgvGSAU5ZxOpOA4snWHov*/